define(
   [
      'dojo/_base/declare',
      'dojo/_base/lang',
      'dijit/registry',
      'dijit/layout/ContentPane'
   ],
   function(declare, lang, registry, ContentPane)
   {
      return declare([ContentPane],
      {
         constructor:function(args)
         {
            dojo.safeMixin(this, args);
         },
         postscript: function(args)
         {
            this.inherited(arguments);
            this.mSubscribedToList = [];
         },
         postMixInProperties: function(){
            // Fix memory leaks
            if (registry.byId(this.id)) {
               registry.byId(this.id).destroyRecursive();
            }
         },
         destroyRecursive: function(){
            this.inherited(arguments);
            
            // Fix memory leaks
            /*
            dojo.forEach(this.getChildren(), function(widget){
               widget.destroyRecursive();
            });
            */
      
            // Unsubscribe to everything
            this.mSubscribedToList = [];
      
            this.inherited(arguments);
         }
      });
   }
);
